home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / comm2 / s342q08.lha / cvrtlog.c < prev    next >
C/C++ Source or Header  |  1994-11-15  |  3KB  |  99 lines

  1. #define TITLE   " CITADEL - Convert User Utility   V3.42"
  2. /**
  3. ***     This program creates one file per Citadel log user
  4. ***     in the format that ADDUSER can use.  The filenames will
  5. ***     be in the format:  Lognnn.ao
  6. **/
  7. #include "ctdl.h"    /* header file  */
  8. #include <stdio.h>
  9. #include <string.h>
  10. #include <stdlib.h>
  11. #include <math.h>
  12. #include <ctype.h>
  13. #include <time.h>
  14. #include <proto/exec.h>
  15. #include <dos/dos.h>
  16. #include <pragmas/dos_pragmas.h>
  17. #include "exec/memory.h"
  18. #include "exec/ports.h"
  19. #include "exec/exec.h"
  20.  
  21. extern CONFIG      cfg;            /* A buncha variables           */
  22. extern logBuffer   logBuf;         /* Pippul buffer                */
  23. extern FILE        *logfl;         /* log file descriptor          */
  24. extern LogTable    *logTab;
  25. extern int         thisLog;
  26.  
  27. void showlog(int i);
  28. int  main ( int, char **);
  29.  
  30. int main(argc,argv)
  31. int  argc;
  32. char **argv;
  33.   {
  34.   int i;
  35.   SYS_FILE fn;
  36.   cfg.weAre = UTILITY;
  37.   printf("%s\n%s\n", TITLE, COPYRIGHT);
  38.  
  39.   if (!readSysTab(FALSE, TRUE)) exit(1);
  40.   sprintf(fn, "%sctdllog.sys", &cfg.logArea);
  41.   if ((logfl = fopen(fn, "rb")) == NULL)
  42.     {
  43.     printf("Can't open the Citadel log!\n");
  44.     exit(1);
  45.  
  46.     }
  47.   initLogBuf(&logBuf);
  48.   for ( i = 0; i < cfg.MAXLOGTAB; i++ )
  49.     {
  50.     getLog(&logBuf,i);
  51.     printf("log #%-4d\r",i);
  52.     if (logBuf.lbflags.L_INUSE) showlog(i);
  53.     }
  54.   return 0;
  55.   }
  56. void showlog(i)
  57. int i;
  58.   {
  59.   FILE *user;
  60.   char filename[30];
  61.   sprintf(filename,"log%03d.ao",i);
  62.   user = fopen(filename,"w");
  63.   if( user == NULL )
  64.     {
  65.     printf("Could not open file %s for user:%s\n",filename,logBuf.lbname);
  66.     return;
  67.     };
  68.   fprintf(user,"%s\n",logBuf.lbname);
  69.   fprintf(user,"%s\n",logBuf.lbpw);
  70.   if( logBuf.lbwidth < 40)logBuf.lbwidth = 40;
  71.   if( logBuf.lbwidth > 80)logBuf.lbwidth = 80;
  72.   fprintf(user,"%d\n",logBuf.lbwidth);
  73.   fprintf(user,"%s\n",logBuf.lbflags.EXPERT       ? "ON" : "OFF");
  74.   fprintf(user,"%s\n",logBuf.lbflags.FLOORS       ? "ON" : "OFF");
  75.   fprintf(user,"%s\n",logBuf.lbflags.LFMASK       ? "ON" : "OFF");
  76.   fprintf(user,"%s\n",logBuf.lbflags.TIME         ? "ON" : "OFF");
  77.   fprintf(user,"%s\n",logBuf.lbflags.OLDTOO       ? "ON" : "OFF");
  78.   fprintf(user,"%s\n",logBuf.lbflags.AIDE         ? "ON" : "OFF");
  79.   fprintf(user,"%d\n",logBuf.lbnulls);
  80.   fprintf(user,"%d\n",logBuf.credit);
  81.   fprintf(user,"%s\n",logBuf.lbflags.NET_PRIVS    ? "ON" : "OFF");
  82.   fprintf(user,"%s\n",logBuf.lbflags.DOOR_PRIVS   ? "ON" : "OFF");
  83.   fprintf(user,"%s\n",logBuf.lbflags.DL_PRIVS     ? "ON" : "OFF");
  84.   fprintf(user,"%s\n",logBuf.lbflags.PERMANENT    ? "ON" : "OFF");
  85.   fprintf(user,"%s\n",logBuf.lbflags.HALF_DUP     ? "ON" : "OFF");
  86.   fprintf(user,"%s\n",logBuf.lbflags.TWIT         ? "ON" : "OFF");
  87.   fprintf(user,"%d\n",logBuf.lbdelay);
  88.   fprintf(user,"%s\n",logBuf.lbflags.ALT_RE       ? "ON" : "OFF");
  89.   fprintf(user,"%s\n",logBuf.lbflags.NoPrompt     ? "ON" : "OFF");
  90.   fprintf(user,"%s\n",logBuf.lbflags.RUGGIE     ? "ON" : "OFF");
  91.   fclose(user);
  92.   }
  93. void crashout(str)
  94. char *str;
  95.   {
  96.   exit(printf(str));
  97.  
  98.   }
  99.